/*
 * @Description: 
 * @Author: yeeChen
 * @Date: 2022-12-15 17:36:40
 * @LastEditTime: 2022-12-16 16:27:17
 * @LastEditors: yeeChen
 */
// 1.创建http模块
const http = require('http')

// 2.创建http实例
const serve = http.createServer()

// 3.给http实例添加添加request事件，用来监听服务器请求
serve.on('request', function (req, res) {
    const url = req.url
    const method = req.method
    const str = `Your request url is ${url},Your request method is ${method}`
    res.end(str)
})

// 4.启动服务器
serve.listen(8080, () => {
    console.log('serve running at http://127.0.0.1:8080');
})